package com.gmtx.syb.home.view;

import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.widget.Toast;

import com.gmtx.syb.R;
import com.gmtx.syb.base.MyBaseFragment;
import com.gmtx.syb.bean.GoodsBean;
import com.gmtx.syb.bean.HomePagePropBean;
import com.gmtx.syb.bean.IndexAdBean;
import com.gmtx.syb.home.presenter.HomePresenter;

import java.util.List;

import butterknife.BindView;

/**
 * Created by Administrator on 2016/11/18.
 */

public class HomeFragment extends MyBaseFragment implements IHomeView {
    @BindView(R.id.recycler_home)
    RecyclerView mRecyclerView;

    private HomePresenter presenter;

    public static final String TAG = "SUN";

    @Override
    protected void setViews() {

    }

    @Override
    protected void init() {
        presenter = new HomePresenter(getContext());
        presenter.attach(this);
        presenter.getIndexAdData();
        presenter.getHomePropData();
    }

    @Override
    public int getContentView() {
        return R.layout.fragment_homepage;
    }


    @Override
    public void showHomePropData(HomePagePropBean homePagePropBean) {
        Log.e(TAG, "showHomePropData: " + homePagePropBean);
    }

    @Override
    public void showIndexAdData(List<IndexAdBean.ResultBean> list) {
        Log.e(TAG, "showHomePropData: " + list);
    }

    @Override
    public void showDailyData(List<GoodsBean.ResultBean.DailySelectionGoodsBean> list) {

    }

    @Override
    public void getDataFailed(Throwable t) {
        Log.e(TAG, "getDataFailed: ", t );
        Toast.makeText(getContext(), "网络请求出错了", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        presenter.detach();
    }
}
